package com.twenty.seven.apollo.demo.socket;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.Charset;
import java.util.Scanner;

public class BIOClient {
    public static void main(String[] args) throws IOException {
        Socket a = new Socket("localhost", 8080);
        OutputStream outputStream = a.getOutputStream();

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入：");
        String msg = scanner.nextLine();
        outputStream.write(msg.getBytes(Charset.forName("utf-8")));
        scanner.close();
        a.close();
    }
}
